package com.demo.web.modules.auth;

import com.demo.common.result.ResponseInfo;
import com.demo.common.result.ResultVo;
import com.demo.dao.auth.entity.AuthLoginNode;
import com.demo.service.auth.AuthUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/auth/user_info")
public class AuthUserInfoController {
    @Autowired
    private AuthUserInfoService myService;

    @GetMapping("/test")
    public String test(){
        return "hello, you are in AuthUserInfo test!";
    }

    //登录
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public ResultVo login(@RequestBody AuthLoginNode login){
        return ResponseInfo.<Object>success(myService.getUser(login));
    }

    //退出登录
    @RequestMapping(value = "/login_out", method = RequestMethod.POST)
    public ResultVo logout(@RequestHeader("token")String token) {
        return ResponseInfo.success();
    }

    //获取权限菜单
    @RequestMapping(value = "/get_menu", method = RequestMethod.POST)
    public ResultVo getPermissionMenu(@RequestBody AuthLoginNode login){
        return ResponseInfo.<Object>success(myService.getMenu(login));
    }
}
